<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="beans.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.alibaba.fastjson.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%-- 	<% --%>
		
// 		String user2jsonstr = request.getParameter("user2");
// 		User2 user2 = JSON.parseObject(user2jsonstr, User2.class);
// 		pageContext.setAttribute("user2", user2);
<%-- 	%> --%>

<!-- 	对于更广泛的应用情况，作为实体的User在定义的时候，数据成员可以有数组或列表 -->
<!-- 	借助于json,自己转换到的对象user2的显示，转换的时候用到的User user2 = -->
<!-- 	JSON.parseObject(user2jsonstr, User2.class); -->
<%-- 	<br> 接到的json数据为：<% --%>
// 		out.print(user2jsonstr);
<%-- 	%><br> --%>
<%-- 	用户号：${user2.userno } --%>
<%-- 	<br> 用户名：${user2.username } --%>
<%-- 	<br> 用户兴趣：${user2.userinterest[0] }:${user2.userinterest[1] }:${user2.userinterest[2] }:${user2.userinterest[3] } --%>



	<br>对于最基本的情况，作为实体的User在定义的时候，数据成员全是字符串

	<%
	request.setCharacterEncoding("utf-8");
	String []userinterests=request.getParameterValues("userinterest");
	String userinterest="";
	for(int i=0;i<userinterests.length;i++){
		userinterest=userinterest+userinterests[i]+"-";
	}
	userinterest=userinterest.substring(0,userinterest.length()-1);	
	pageContext.setAttribute("userinterest", userinterest);
	%>
	<jsp:useBean id="user" class="beans.User" scope="request">	</jsp:useBean>
	<jsp:setProperty property="*" name="user" />
	<jsp:setProperty property="userinterest" value="${userinterest}" name="user" />
	<br>用户号：${user.userno }
	<br> 用户名：${user.username }
	<br> 用户兴趣：${user.userinterest }

</body>
</body>
</html>